// pages/details/index.js
import Toast from '../../miniprogram_npm/@vant/weapp/toast/toast';
import Dialog from '../../miniprogram_npm/@vant/weapp/dialog/dialog';

const md5 = require('../../utils/md5.js');
const app = getApp()
Page({

    /**
     * 页面的初始数据
     */
    data: {
        // 文件上传
        fileList: [],
        isLogin: wx.getStorageSync('isLogin') ? wx.getStorageSync('isLogin') : false,
        // 大类型: 1-项目预测, 2-工作事业选择, 3-情感咨询, 4-公关审核
        type: 1,
        dataList: [], //数据列表
        cName: "",
        currentItem: null,
        placeholder: "",
        currentId: 0,
        clickType: 1,
        title: '',
        message: '',
        show: false,
        // 用户选择, 大类型下的,具体某个小选项
        itype: 0,
        // 工作事业选择, 职位内容
        jobTitle: '',
        // 选择的问题
        chooseQuestion: '',
        zifei: 0,
        freeTimes: 0,
        isFree: 0,
        payShow: false,
        //输入内容
        title1: '',
        title2: '',
        title3: '',
        date1: '',
        startdate: '',
        enddate: '',
        questions: [],
        combo_type: 0, //次卡套餐类型
        combo_type2: 0, //月卡套餐类型
        cid3: 19,
        //年月日选择器
        multiDateArray: [
            ['选择', '2021', '2022', '2023'],
            ['选择'],
            ['选择']
        ],
        multiDateIndex: [0, 0, 0],
        multiDateInde1: [0, 0, 0],
        multiDateInde2: [0, 0, 0],
        enddateStart: '',
        enddateEnd: '',
        startdateStart: '',
        startdateEnd: '',
        xzdata1: false,
        xztype: 1,
        text1: '',
        text2: '',
        theme: '',
        loginsrc: '',
        huaweilogin: '',
        ffbtn: '',
        mfbtn: '',
        wode: '',
        indexpng: '',
        isIos: 0,
        uid: 0,
        ucid3: 0,
        respData: {},
        isCacheUserPhone: false
    },
    // 绑定用户图片上传后的操作
    onAfterRead(event) {
        let urls = event.detail.file;
        // 确保 file 是一个数组
        if (Array.isArray(urls)) {
            const newFileList = urls.map((item, index) => ({
                url: item.thumb, // 根据实际情况选择属性
                name: '图片' + (index + 1), // 这里可以根据需要自定义名称
                isImage: true,
                deletable: true,                
            }));
            // 合并新文件列表与现有文件列表
            this.data.fileList = this.data.fileList.concat(newFileList);
            console.log(this.data.fileList); // 打印合并后的文件列表
            
            this.setData({
                fileList: this.data.fileList,
                isShowTitle1: 0,
                title1: '咨询人'
            });
        }
    },
    doNothing: function() {
        // 空函数，仅用于阻止事件冒泡
    },    
    getPhoneNumber1(e) {
        let {
            encryptedData,
            iv,
            code
        } = e.detail
        // 如果授权获取手机号则进入下个页面 
        if (code) {
            this.getPhone(code, 1)
        } else {
            Dialog.alert({
                title: '温馨提示',
                message: '请授权登录',
                theme: 'round-button',
            }).then(() => {
                // on close
            });
        }
    },
    getPhoneNumber(e) {
        console.log(e);
        let {
            encryptedData,
            iv,
            code
        } = e.detail
        // 如果授权获取手机号则进入下个页面 
        if (code) {
            this.getPhone(code, 0)
        } else {
            Dialog.alert({
                title: '温馨提示',
                message: '请授权登录',
                theme: 'round-button',
            }).then(() => {
                // on close
            });
        }
    },

    // 用户获取手机号
    getPhone(code, type) {
        let that = this
        var reqUri = app.globalData.domain + 'index/index/getUserWxPhone';
        wx.request({
            url: reqUri,
            method: 'POST',
            data: {
                code,
            },
            success(res) {
                console.log(res)
                if (res.data.code == app.globalData.successCode) {
                    let {
                        phoneNumber
                    } = res.data.data
                    // 将用户的 手机号缓存
                    wx.setStorageSync('user_phone', res.data.data);
                    that.setData({isCacheUserPhone: true});
                    that.login(phoneNumber, type)
                } else {
                    wx.showModal({
                        title: '温馨提示',
                        showCancel: false,
                        content: res.data.msg
                    })
                    return;
                }
            }
        })
    },
    // showCombo1(){
    //     this.setData({
    //         isFree: 1,
    //     });
    //     console.log(this.data.isFree);
    // },
    // 用户登录
    login(phone, type) {
        let that = this
        let reqUri = app.globalData.domain + 'index/index/doReg';
        let uid = wx.getStorageSync('toid') ?? 0;
        let cid3 = wx.getStorageSync('tocid3');
        let agentId = wx.getStorageSync('agentId') ?? 0;

        if (!cid3 || cid3 == undefined) cid3 = that.data.cid3;
        // console.log('//'+cid3+'//');
        // console.log(that.data.cid3);        
        // return ;
        wx.request({
            url: reqUri,
            method: 'POST',
            data: {
                phone,
                types: 'mini',
                openid: app.globalData.openId,
                uid: uid,
                cid3: cid3,
                agentId: wx.getStorageSync('agentId') ?? 1
            },
            success(res) {
                console.log(res)
                if (res.data.code == app.globalData.successCode) {
                    if (type == 1) {
                        wx.setStorageSync('isLogin', true)
                        that.setData({
                            isLogin: wx.getStorageSync('isLogin')
                        })
                        let cacheUserInfo = wx.getStorageSync('user_phone');
                        let user_phone = (cacheUserInfo.phoneNumber && typeof (cacheUserInfo.phoneNumber) != 'undefined') ? cacheUserInfo.phoneNumber : ''
                        let res = wx.getSystemInfoSync();
                        let isIos = 0;
                        if (res.platform == 'ios') {
                            isIos = 1;
                        }
                        wx.request({
                            url: app.globalData.domain + 'v4/index/getUserIsUse',
                            data: {
                                user_phone: user_phone,
                                type: that.data.cid3,
                                isIos: isIos
                            },
                            success(res) {
                                console.log(res.data.data, '查看当前用户信息')
                                if (res.data.code == 0) {
                                    that.setData({
                                        respData: res.data.data,
                                        zifei: res.data.data.zifei,
                                        freeTimes: res.data.data.times,
                                        isFree: res.data.data.is_used,
                                        combo_type: res.data.data.combo_type,
                                        combo_type2: res.data.data.combo_type2,
                                        audit: res.data.data.audit
                                    });
                                    // that.showCombo()
                                }
                            }
                        })
                    } else {
                        Toast.success('登录成功,即将跳转')
                        wx.setStorageSync('isLogin', true)
                        wx.redirectTo({
                            url: '/pages/personal/me',
                        })
                    }

                } else {
                    wx.showModal({
                        title: '温馨提示',
                        showCancel: false,
                        content: res.data.msg
                    })
                    return;
                }
            }
        })
    },
    /**
     * 用户输入咨询的问问题
     */
    changeMsg(e) {
        this.setData({
            message: e.detail.value
        });
    },
    /**
     * 用户输入职位
     */
    changeJob(e) {
        this.setData({
            jobTitle: e.detail.value
        });
    },
    /**
     * 选择咨询--打开
     */
    showPopup() {
        this.setData({
            show: true
        });
    },
    /**
     * 选择咨询--关闭
     */
    onClose() {
        this.setData({
            show: false
        });
    },
    showCombo: function () {
        // 显示套餐前 先校验字段是否填写
        for (let i = 0; i < this.data.currentItem.questions.length; i++) {
            let k = this.data.currentItem.questions[i]
            if (this.data[k] == '') {
                Toast('请输入：' + this.data.currentItem.prompts[i]);
                return;
            }
        }
        //检测今日是否咨询过该问题
        if (this.getMd5Today()) {
            wx.showModal({
                title: '温馨提示',
                showCancel: false,
                content: '同一问题每日只能咨询一次'
            })
            return;
        }

        this.setData({
            payShow: true
        });
    },
    /**
     * 隐藏套餐层
     */
    closeCombo: function () {
        this.setData({
            payShow: false
        });
    },
    chooseDetail1(itype, title) {
        var itype = itype;
        var chooseQuestion = title;
        var currentItem = null;
        var placeholder = "";
        let xzdata1 = false
        this.data.dataList.forEach(e => {
            let arr = e.questions
            if (e.id == itype) {
                console.log(e);
                currentItem = e;
                placeholder = e.prompt

                //判断是否有时间选项
                if (arr.indexOf('date1') == -1) {
                    xzdata1 = true
                } else {
                    xzdata1 = false
                }
                console.log(xzdata1);
            }
        })
        this.gettext()
        this.setData({
            xzdata1: xzdata1
        })
        //初始化输入数据
        this.setData({
            currentItem: currentItem,
            placeholder: placeholder,
            itype: itype,
            show: false,
            chooseQuestion: chooseQuestion,
            title1: '',
            title2: '',
            title3: '',
            date1: '',
            startdate: '',
            enddate: '',
            multiDateIndex: [0, 0, 0],
            multiDateInde1: [0, 0, 0],
            multiDateInde2: [0, 0, 0],
            enddateStart: '',
            enddateEnd: '',
            startdateStart: '',
            startdateEnd: '',
            isShowTitle1: 1
        });
    },
    /**
     * 选择 xx菜单下, 具体咨询类目
     */
    chooseDetail(e) {
        var itype = e.currentTarget.dataset.itype;
        var chooseQuestion = e.currentTarget.dataset.title;
        var currentItem = null;
        var placeholder = "";
        let xzdata1 = false
        this.data.dataList.forEach(e => {
            let arr = e.questions
            if (e.id == itype) {
                console.log(e);
                currentItem = e;
                placeholder = e.prompt

                //判断是否有时间选项
                if (arr.indexOf('date1') == -1) {
                    xzdata1 = true
                } else {
                    xzdata1 = false
                }
                console.log(xzdata1);
            }
        })
        this.gettext()
        this.setData({
            xzdata1: xzdata1
        })
        //初始化输入数据
        this.setData({
            currentItem: currentItem,
            placeholder: placeholder,
            itype: itype,
            show: false,
            chooseQuestion: chooseQuestion,
            title1: '',
            title2: '',
            title3: '',
            date1: '',
            startdate: '',
            enddate: '',
            multiDateIndex: [0, 0, 0],
            multiDateInde1: [0, 0, 0],
            multiDateInde2: [0, 0, 0],
            enddateStart: '',
            enddateEnd: '',
            startdateStart: '',
            startdateEnd: '',
        });
    },
    gettext() {
        let that = this;
        wx.request({
            url: app.globalData.domain + 'v4/index/gettext',
            success(res) {
                if (res.data.code == 0) {
                    console.log(res.data)
                    that.setData({
                        text1: res.data.data1,
                        text7: res.data.data7,
                        text2: res.data.data2,
                    });

                }
            }
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        console.log('---', options);
        //将分享者用户id 放入缓存
        let uid = wx.getStorageSync('toid') ?? 0;
        let ucid3 = wx.getStorageSync('tocid3') ?? 0;
        if (!uid || !ucid3) {
            uid = options.uid ?? 0;
            ucid3 = options.cid3 ?? 0;
            if (uid && ucid3) {
                wx.setStorageSync('toid', uid);
                wx.setStorageSync('tocid3', ucid3);
            }
        }

        let years = ['选择']
        for (let i = 2024; i <= 2037; i++) {
            years.push('' + i)
        }
        this.data.multiDateArray[0] = years
        this.setData({
            multiDateArray: this.data.multiDateArray
        })

        let that = this;
        let cacheUserInfo = wx.getStorageSync('user_phone');
        let user_phone = (cacheUserInfo.phoneNumber && typeof (cacheUserInfo.phoneNumber) != 'undefined') ? cacheUserInfo.phoneNumber : ''
        let {
            type,
            cid3,
        } = options

        //变量赋值
        if (user_phone) this.setData({isCacheUserPhone: true});
        this.setData({
            type,
            openId: app.globalData.openId,
            cid3: cid3,
        });
        console.log(type + '==' + cid3);
        let isChooseProtocal = wx.getStorageSync('isChooseProtocal') ? wx.getStorageSync('isChooseProtocal') : false;
        //变量赋值
        this.setData({
            isChooseProtocal: isChooseProtocal,
        });
        if (!isChooseProtocal) {
            wx.setStorageSync('toMenu', '/pages/newDetail/indexV2?type=' + type + '&cid3=' + cid3);
            this.toLogin();
        }
        //获取分类下问题列表
        wx.request({
            url: app.globalData.domain + 'v4/index/getQuestionList',
            data: {
                cid3: cid3,
            },
            success(res) {
                if (res.data.code == 0) {
                    let cName = res.data.data[0].cid3_name
                    that.setData({
                        dataList: res.data.data,
                        cName: cName,
                    });
                    if (options.qid) {
                        that.data.dataList.forEach(i => {
                            if (i.id == options.qid) {
                                that.chooseDetail1(i.id, i.title)
                            }
                        })
                    }
                }
            }
        })
        // 判断当前用户, 是否可以免费次数
        let res = wx.getSystemInfoSync();
        let isIos = 0;
        if (res.platform == 'ios') {
            isIos = 1;
        }
        wx.request({
            url: app.globalData.domain + 'v4/index/getUserIsUse',
            data: {
                user_phone: user_phone,
                type: cid3,
                isIos: isIos
            },
            success(res) {
                if (res.data.code == 0) {
                    that.setData({
                        zifei: res.data.data.zifei,
                        freeTimes: res.data.data.times,
                        isFree: res.data.data.is_used,
                        combo_type: res.data.data.combo_type,
                        combo_type2: res.data.data.combo_type2,
                        audit: res.data.data.audit,
                        toid: res.data.data.uid,
                    });
                } else {
                    that.setData({
                        isFree: 0,
                    });
                }
            }
        })
        wx.showShareMenu({
            withShareTicket: true,
            menus: ['shareAppMessage', 'shareTimeline']
        });
        if (!options.qid) {
            setTimeout(() => {
                app.show(this, 'show', 1)
            }, 1000);
        }
    },
    onShareAppMessage() {
        let that = this;
        return {
            title: '天纪云',
            path: '/pages/newDetail/indexV2?type=' + that.data.type + '&cid3=' + that.data.cid3 + '&uid=' + that.data.toid
        }
    },
    onShareTimeline() {
        let that = this;
        return {
            title: '天纪云',
            path: '/pages/newDetail/indexV2?type=' + that.data.type + '&cid3=' + that.data.cid3 + '&uid=' + that.data.toid
        }
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {
        if (wx.getStorageSync('theme') == 'style1') {
            this.setData({
                theme: 'style1',
                loginsrc: 'https://aiw.oss-cn-beijing.aliyuncs.com/logo.png',
                huaweilogin: 'https://aiw.oss-cn-beijing.aliyuncs.com/huawei1.png',
                ffbtn: 'https://aiw.oss-cn-beijing.aliyuncs.com/year/Group15.png',
                admf: 'https://aiw.oss-cn-beijing.aliyuncs.com/v3/admf2.png',
                mfbtn: 'https://aiw.oss-cn-beijing.aliyuncs.com/year/Group16.png',
                wode: '/images/wodepng.png',
                indexpng: '/images/indexpng.png'
            })
        } else {
            this.setData({
                theme: 'init',
                loginsrc: 'https://aiw.oss-cn-beijing.aliyuncs.com/logo.png',
                huaweilogin: 'https://aiw.oss-cn-beijing.aliyuncs.com/huawei1.png',
                ffbtn: 'https://aiw.oss-cn-beijing.aliyuncs.com/v3/-s-ks_ff.png',
                admf: 'https://aiw.oss-cn-beijing.aliyuncs.com/v3/admf1.png',
                mfbtn: 'https://aiw.oss-cn-beijing.aliyuncs.com/v3/ks_mf@2x.png',
                wode: 'https://aiw.oss-cn-beijing.aliyuncs.com/v3/tab_me_n@2x.png',
                indexpng: 'https://aiw.oss-cn-beijing.aliyuncs.com/v3/tab_home_n@2x(1).png'
            })
        }
        let cacheUserInfo = wx.getStorageSync('user_phone');
        let user_phone = (cacheUserInfo.phoneNumber && typeof (cacheUserInfo.phoneNumber) != 'undefined') ? cacheUserInfo.phoneNumber : ''
        let that = this;

        this.setData({
            isLogin: wx.getStorageSync('isLogin')
        })
        let resType = wx.getSystemInfoSync();
        let isIos = 0;
        if (resType.platform == 'ios') {
            isIos = 1;
        }
        if (this.data.isLogin) {
            wx.request({
                url: app.globalData.domain + 'v4/index/getUserIsUse',
                data: {
                    user_phone: user_phone,
                    type: this.data.cid3,
                    isIos: isIos
                },
                success(res) {
                    console.log(res.data.data.is_used)
                    if (res.data.code == 0) {
                        that.setData({
                            respData: res.data.data,
                            zifei: res.data.data.zifei,
                            freeTimes: res.data.data.times,
                            isFree: res.data.data.is_used,
                            combo_type: res.data.data.combo_type,
                            combo_type2: res.data.data.combo_type2,
                            audit: res.data.data.audit
                        });
                    }
                }
            })
        }

        // setTimeout(() => {
        //     app.show(this, 'show', 1)
        // }, 1000);
    },
    onHide: function () {
        setTimeout(() => {
            app.show(this, 'show', 0)
        }, 1000);
    },
    // 点击确定
    onConfirm() {
        let {
            types
        } = this.data.currentItem
        let xintai = 'choseInfo.xintai'
        let initiative = 'choseInfo.initiative'
        let is_help = 'choseInfo.is_help'
        if (types == 1) {
            this.setData({
                [xintai]: this.data.currentItem,
            })
        } else if (types == 2) {
            this.setData({
                [initiative]: this.data.currentItem,
            })
        } else {
            this.setData({
                [is_help]: this.data.currentItem,
            })
        }
        console.log(this.data.choseInfo)
    },
    checkIsLogin() {
        var reqUri = app.globalData.domain + 'index/index/index?types=';
        wx.request({
            url: reqUri,
            success(res) {
                if (res.data.code == app.globalData.successCode) {
                    that.setData({
                        id: res.data.data.id,
                        num_sn: res.data.data.num_sn,
                        result: res.data.data.result,
                        tuijin: res.data.data.tuijin,
                        current: res.data.data.current,
                        xintai: res.data.data.xintai,
                        solution: res.data.data.solution,
                        idea: res.data.data.idea
                    });
                }
            }
        })
    },
    /**
     * 至首页
     */
    toHome() {
        wx.navigateTo({
            url: '/pages/menu/index',
        })
    },
    /**
     * 至个人中心
     */
    toMe() {
        wx.navigateTo({
            url: '/pages/personal/me',
        })
    },
    showModal() {
        wx.navigateTo({
            url: '/pages/newDetail/video',
        })
    },
    /**
     * 至授权页
     */
    toLogin() {
        wx.redirectTo({
            url: '/pages/login/index',
        })
    },
    share: function () {
        let that = this;
        wx.showModal({
            title: '邀新有奖',
            showCancel: false,
            content: '点击右上角发送给朋友/分享到朋友圈邀请新用户注册送一次免费预测',
        })
    },
    setMd5Today: function () {
        let tmpdata = {
            question_id: this.data.currentItem.id,
        }
        for (let i = 0; i < this.data.currentItem.questions.length; i++) {
            let k = this.data.currentItem.questions[i]
            tmpdata[k] = this.data[k]
        }
        console.log(md5.hexMD5(JSON.stringify(tmpdata)))
        var curDate = new Date();
        var curDateDetail = curDate.getFullYear() + '-' + curDate.getMonth() + '-' + curDate.getDate();
        let cacheDateKey = curDateDetail + '_' + md5.hexMD5(JSON.stringify(tmpdata))

        wx.setStorageSync(cacheDateKey, 1);
        return true
    },
    getMd5Today: function () {
        let tmpdata = {
            question_id: this.data.currentItem.id,
        }
        for (let i = 0; i < this.data.currentItem.questions.length; i++) {
            let k = this.data.currentItem.questions[i]
            tmpdata[k] = this.data[k]
        }
        console.log(md5.hexMD5(JSON.stringify(tmpdata)))
        var curDate = new Date();
        var curDateDetail = curDate.getFullYear() + '-' + curDate.getMonth() + '-' + curDate.getDate();
        let cacheDateKey = curDateDetail + '_' + md5.hexMD5(JSON.stringify(tmpdata))
        var cacheDate = wx.getStorageSync(cacheDateKey);
        if (cacheDate) {
            return true
        }
        return false
    },
    /**
     * 免费体验的测试
     */
    toFreeLoading: function () {
        let that = this
        //校验字段是否填写
        for (let i = 0; i < this.data.currentItem.questions.length; i++) {
            let k = this.data.currentItem.questions[i]
            if (this.data[k] == '') {
                Toast('请输入：' + this.data.currentItem.prompts[i]);
                return;
            }
        }
        //验证股票 区间值跨度是否太大
        if (this.data.currentItem.id == 55 || this.data.currentItem.id == 56) {
            //检测是否是数字
            let min = this.data[this.data.currentItem.questions[3]];
            let max = this.data[this.data.currentItem.questions[4]];
            if (!(/(^[0-9]*$)/.test(min))) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值只能是数字'
                })
                return;
            }
            if (!(/(^[0-9]*$)/.test(max))) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最高值只能是数字'
                })
                return;
            }
            //500以内的一块一块的问 500以上的10块十块问，1000以上的50块50块的问 最大跨度不能超过100
            if (max < 500 && (max - min) > 100) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值和最高值跨度不能大于100'
                })
                return;
            }
            if (min >= 500 && (max - min) > 1000) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值和最高值跨度不能大于1000'
                })
                return;
            }
            if (min >= 1000 && (max - min) > 3000) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值和最高值跨度不能大于3000'
                })
                return;
            }
        }
        //检测今日是否咨询过该问题
        if (this.getMd5Today()) {
            wx.showModal({
                title: '温馨提示',
                showCancel: false,
                content: '同一问题每日只能咨询一次'
            })
            return;
        }


        // 弹窗提示
        wx.showModal({
            title: '温馨提示',
            content: '请再次确认您的输入内容',
            success(res) {
                if (res.confirm) {
                    that.latestPersonPredict(1)
                }
            }
        })
    },
    dateNum: function (dateString1, dateString2) {
        function parseDate(str) {
            const parts = str.split('-').map(Number);
            if (parts.length === 1) {
                return new Date(parts[0], 0, 1);
            }
            if (parts.length === 2) {
                return new Date(parts[0], parts[1] - 1, 1);
            }
            if (parts.length === 3) {
                return new Date(parts[0], parts[1] - 1, parts[2]);
            }
        }

        // 计算时间差（以天为单位）  
        function diffInDays(date1, date2) {
            return Math.floor((date2 - date1) / (1000 * 60 * 60 * 24));
        }

        // 解析输入的日期字符串  
        const date1 = parseDate(dateString1);
        const date2 = parseDate(dateString2);

        // 确保date1是较早的日期  
        if (date1 > date2) {
            [date1, date2] = [date2, date1];
        }

        // 检查日期字符串的格式并返回相应的时间差  
        if (date1 && date2) {
            if (dateString1.split('-').length === 1 && dateString2.split('-').length === 1) {
                // 年格式  
                return date2.getFullYear() - date1.getFullYear();
            } else if (dateString1.split('-').length === 2 && dateString2.split('-').length === 2) {
                // 年月格式  
                const yearsDiff = date2.getFullYear() - date1.getFullYear();
                const monthsDiff = date2.getMonth() - date1.getMonth();
                return yearsDiff * 12 + monthsDiff;
            } else if (dateString1.split('-').length === 3 && dateString2.split('-').length === 3) {
                // 年月日格式  
                return diffInDays(date1, date2);
            }
        }
    },
    //看广告免费咨询
    adShow: function (e) {
        let that = this;
        let answer_type = that.data.currentItem.answer_type;
        let cacheUserInfo = wx.getStorageSync('user_phone');
        let user_phone = (cacheUserInfo.phoneNumber && typeof (cacheUserInfo.phoneNumber) != 'undefined') ? cacheUserInfo.phoneNumber : ''
        let videoAd = null;
        let meunID = that.data.currentItem.id;
        let meunIDs = [34, 35, 55, 56];
        for (let i = 0; i < this.data.currentItem.questions.length; i++) {
            let k = this.data.currentItem.questions[i]
            if (this.data[k] == '') {
                Toast('请输入：' + this.data.currentItem.prompts[i]);
                return;
            }
        }
        //检测今日是否咨询过该问题
        if (this.getMd5Today()) {
            wx.showModal({
                title: '温馨提示',
                showCancel: false,
                content: '同一问题每日只能咨询一次'
            })
            return;
        }
        // startdate: that.data.startdate  enddate,
        if (meunIDs.indexOf(meunID) != -1) {
            //时间区间看多次广告
            let startdate = that.data.startdate;
            let enddate = that.data.enddate;
            if (startdate == '' || enddate == '') {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '开始时间 / 结束时间为空'
                })
                return;
            }
            //判断格式是否一致
            let time1 = startdate.split('-').map(Number);
            let time2 = enddate.split('-').map(Number);
            if (time1.length !== time2.length) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '开始时间 / 结束时间 格式不一致'
                })
                return;
            }
            //判断相隔的年  月 日
            let day = this.dateNum(startdate, enddate);
            day += 1;
            let adeNum = wx.getStorageSync('adeNum');
            if (!adeNum || adeNum > day) adeNum = day;
            if (day >= 10) {
                day = 10;
                adeNum = 10;
            }
            //验证股票 区间值跨度是否太大
            if ((this.data.currentItem.id == 55 || this.data.currentItem.id == 56) && (day < 10)) {
                //检测是否是数字
                let min = this.data[this.data.currentItem.questions[3]];
                let max = this.data[this.data.currentItem.questions[4]];

                if (!(/(^[0-9]*$)/.test(min))) {
                    wx.showModal({
                        title: '温馨提示',
                        showCancel: false,
                        content: '最低值只能是数字'
                    })
                    return;
                }
                if (!(/(^[0-9]*$)/.test(max))) {
                    wx.showModal({
                        title: '温馨提示',
                        showCancel: false,
                        content: '最高值只能是数字'
                    })
                    return;
                }
                //500以内的一块一块的问 500以上的10块十块问，1000以上的50块50块的问 最大跨度不能超过100
                if (max < 500 && (max - min) > 100) {
                    wx.showModal({
                        title: '温馨提示',
                        showCancel: false,
                        content: '最低值和最高值跨度不能大于100'
                    })
                    return;
                }
                if (min >= 500 && (max - min) > 1000) {
                    wx.showModal({
                        title: '温馨提示',
                        showCancel: false,
                        content: '最低值和最高值跨度不能大于1000'
                    })
                    return;
                }
                if (min >= 1000 && (max - min) > 3000) {
                    wx.showModal({
                        title: '温馨提示',
                        showCancel: false,
                        content: '最低值和最高值跨度不能大于3000'
                    })
                    return;
                }
                //js 计算大数组 递加模拟器直接卡死,所以使用php计算
                wx.request({
                    url: app.globalData.domain + 'v4/index/getNum',
                    data: {
                        min: min,
                        max: max,
                    },
                    success: function (res) {
                        if (res.data.code == 0) {
                            let numLength = res.data.data;
                            let allNum = day * numLength;
                            if (allNum >= 10) {
                                allNum = 10;
                            }

                            let adeNum = wx.getStorageSync('adeNum');
                            if (!adeNum || adeNum > allNum) adeNum = allNum;
                            console.log(allNum + '++' + adeNum);
                            // adeNum = 1;
                            console.log('==' + adeNum);
                            wx.showModal({
                                title: '温馨提示',
                                content: '当前问题需观看 ' + allNum + ' 次广告,还需' + adeNum + '次',
                                success(res) {
                                    if (res.confirm) {
                                        let adNum = 0;
                                        // for (var i = 0; i < day; i++) { 

                                        let videoAd = null;
                                        if (wx.createRewardedVideoAd) {

                                            videoAd = wx.createRewardedVideoAd({
                                                adUnitId: 'adunit-b35cfe40852d6b0f'
                                            })
                                            videoAd.onLoad(() => {})
                                            videoAd.onError((err) => {
                                                console.error('激励视频光告加载失败', err)
                                            })
                                            videoAd.onClose((res) => {
                                                videoAd.offClose();
                                                if (res && res.isEnded) {
                                                    if (!videoAd) return;
                                                    videoAd.offClose();
                                                    adeNum -= 1;
                                                    wx.setStorageSync('adeNum', adeNum);
                                                    if (adeNum == 0) {
                                                        //下发奖励
                                                        wx.request({
                                                            url: app.globalData.domain + 'v4/index/adShow',
                                                            data: {
                                                                answer_type: answer_type,
                                                                user_phone: user_phone,
                                                                type: 1,
                                                            },
                                                            success: function (res) {
                                                                console.log(res)
                                                                if (res.data.code != 0) {
                                                                    wx.showModal({
                                                                        title: '温馨提示',
                                                                        showCancel: false,
                                                                        content: res.data.msg
                                                                    })
                                                                    return;
                                                                }
                                                                that.latestPersonPredict(0);
                                                                return;
                                                            }
                                                        })
                                                    }


                                                } else {
                                                    console.log('000')
                                                    // 播放中途退出，不下发游戏奖励
                                                }
                                            })
                                        }

                                        // 用户触发广告后，显示激励视频广告
                                        if (videoAd) {
                                            videoAd.show().catch(() => {
                                                // 失败重试
                                                videoAd.load()
                                                    .then(() => videoAd.show())
                                                    .catch(err => {
                                                        console.error('激励视频 广告显示失败', err)
                                                    })
                                            })
                                        }
                                    }
                                    // }
                                }
                            })
                        }
                    }
                })

            } else {
                // 如果出现 NAN
                if (isNaN(day) || isNaN(adeNum)) {
                    day = 1;
                    adeNum = 1;
                }
                //34 35 估计数值不带区间
                // adeNum = 1;
                wx.showModal({
                    title: '温馨提示',
                    content: '当前问题共需观看 ' + day + ' 次广告,还剩' + adeNum + '次',
                    success(res) {
                        if (res.confirm) {
                            let adNum = 0;
                            // for (var i = 0; i < day; i++) { 

                            let videoAd = null;
                            if (wx.createRewardedVideoAd) {

                                videoAd = wx.createRewardedVideoAd({
                                    adUnitId: 'adunit-b35cfe40852d6b0f'
                                })
                                try {
                                    if (videoAd.closeHandler) {
                                        videoAd.offClose(videoAd.closeHandler);
                                        console.log("---videoAd.offClose 卸载成功---");
                                    }
                                } catch (e) {
                                    console.log("---videoAd.offClose 卸载失败---");
                                    console.error(e);
                                }
                                videoAd.onLoad(() => {})
                                videoAd.onError((err) => {
                                    console.error('激励视频光告加载失败', err)
                                })
                                videoAd.closeHandler = function (res) {
                                    // 用户点击了【关闭广告】按钮
                                    videoAd.offClose();
                                    if (res && res.isEnded || res === undefined) {
                                        if (!videoAd) return;
                                        videoAd.offClose();
                                        adeNum -= 1;
                                        wx.setStorageSync('adeNum', adeNum);
                                        if (adeNum == 0) {
                                            //下发奖励
                                            wx.request({
                                                url: app.globalData.domain + 'v4/index/adShow',
                                                data: {
                                                    answer_type: answer_type,
                                                    user_phone: user_phone,
                                                    type: 1,
                                                },
                                                success: function (res) {
                                                    console.log(res)
                                                    if (res.data.code != 0) {
                                                        wx.showModal({
                                                            title: '温馨提示',
                                                            showCancel: false,
                                                            content: res.data.msg
                                                        })
                                                        return;
                                                    }
                                                    that.latestPersonPredict(0);
                                                    return;
                                                }
                                            })
                                        }


                                    } else {
                                        console.log('000')
                                        // 播放中途退出，不下发游戏奖励
                                    }
                                };
                                videoAd.onClose(videoAd.closeHandler);
                            }

                            // 用户触发广告后，显示激励视频广告
                            if (videoAd) {
                                videoAd.show().catch(() => {
                                    // 失败重试
                                    videoAd.load()
                                        .then(() => videoAd.show())
                                        .catch(err => {
                                            console.error('激励视频 广告显示失败', err)
                                        })
                                })
                            }
                        }
                        // }
                    }
                })
            }



        } else {
            //正常看一次广告
            if (wx.createRewardedVideoAd) {
                videoAd = wx.createRewardedVideoAd({
                    adUnitId: 'adunit-b35cfe40852d6b0f'
                })
                try {
                    if (videoAd.closeHandler) {
                        videoAd.offClose(videoAd.closeHandler);
                        console.log("---videoAd.offClose 卸载成功---");
                    }
                } catch (e) {
                    console.log("---videoAd.offClose 卸载失败---");
                    console.error(e);
                }
                videoAd.onLoad(() => {})
                videoAd.onError((err) => {
                    console.error('激励视频光告加载失败', err)
                })
                videoAd.closeHandler = function (res) {
                    // 用户点击了【关闭广告】按钮
                    videoAd.offClose();
                    if (res && res.isEnded || res === undefined) {
                        // 正常播放结束，可以下发奖励
                        if (!videoAd) return

                        videoAd.offClose();
                        // 正常播放结束，可以下发游戏奖励
                        console.log('111');
                        wx.request({
                            url: app.globalData.domain + 'v4/index/adShow',
                            data: {
                                answer_type: answer_type,
                                user_phone: user_phone,
                                type: 1
                            },
                            success: function (res) {
                                console.log(res)
                                if (res.data.code != 0) {
                                    wx.showModal({
                                        title: '温馨提示',
                                        showCancel: false,
                                        content: res.data.msg
                                    })
                                    return;
                                }
                                that.latestPersonPredict(0);
                                return;
                            }
                        })
                    } else {
                        //提前关闭小程序
                    }
                };
                videoAd.onClose(videoAd.closeHandler);
                // 用户触发广告后，显示激励视频广告
                if (videoAd) {
                    videoAd.show().catch(() => {
                        // 失败重试
                        videoAd.load()
                            .then(() => videoAd.show())
                            .catch(err => {
                                console.error('激励视频 广告显示失败', err)
                            })
                    })
                }
            }
        }


    },
    /**
     * 付费预测
     */
    toPayLoading: function (e) {
        let that = this
        // 判断当前用户, 是否可以免费次数
        let cacheUserInfo = wx.getStorageSync('user_phone');
        let user_phone = (cacheUserInfo.phoneNumber && typeof (cacheUserInfo.phoneNumber) != 'undefined') ? cacheUserInfo.phoneNumber : ''
        let combo_type = e.currentTarget.dataset.combo_type; //套餐类型
        let types = this.data.currentItem.answer_type

        //验证股票 区间值跨度是否太大
        if (this.data.currentItem.id == 55 || this.data.currentItem.id == 56) {
            //检测是否是数字
            let min = this.data[this.data.currentItem.questions[3]];
            let max = this.data[this.data.currentItem.questions[4]];
            if (!(/(^[0-9]*$)/.test(min))) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值只能是数字'
                })
                return;
            }
            if (!(/(^[0-9]*$)/.test(max))) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最高值只能是数字'
                })
                return;
            }
            //500以内的一块一块的问 500以上的10块十块问，1000以上的50块50块的问 最大跨度不能超过100
            if (max < 500 && (max - min) > 100) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值和最高值跨度不能大于100'
                })
                return;
            }
            if (min >= 500 && (max - min) > 1000) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值和最高值跨度不能大于1000'
                })
                return;
            }
            if (min >= 1000 && (max - min) > 3000) {
                wx.showModal({
                    title: '温馨提示',
                    showCancel: false,
                    content: '最低值和最高值跨度不能大于3000'
                })
                return;
            }
        }
        // 弹窗提示
        wx.showModal({
            title: '温馨提示',
            content: '请再次确认您的输入内容',
            success(res) {
                if (res.confirm) { //确认
                    wx.request({
                        url: app.globalData.domain + 'v3/index/intoOrder',
                        data: {
                            type: types,
                            combo_type: combo_type,
                            user_phone: user_phone
                        },
                        success: function (res) {
                            console.log(res)
                            if (res.data.code != 0) {
                                wx.showModal({
                                    title: '温馨提示',
                                    showCancel: false,
                                    content: res.data.msg
                                })
                                return;
                            }
                            // 发起支付
                            wx.requestPayment({
                                timeStamp: res.data.data.timeStamp,
                                nonceStr: res.data.data.nonceStr,
                                package: res.data.data.package,
                                signType: res.data.data.signType,
                                paySign: res.data.data.paySign,
                                success(res) {
                                    console.log('debug支付成功')
                                    that.latestPersonPredict(0)
                                },
                                fail(res) {
                                    wx.showModal({
                                        title: '温馨提示',
                                        showCancel: false,
                                        content: '支付失败!'
                                    })
                                    return;
                                }
                            })
                        }
                    })
                }
            }
        })

    },
    /**
     * 提交ai预测
     */
    latestPersonPredict: function (time_pay = 0) {
        // 判断当前用户, 是否可以免费次数
        let cacheUserInfo = wx.getStorageSync('user_phone');
        let user_phone = (cacheUserInfo.phoneNumber && typeof (cacheUserInfo.phoneNumber) != 'undefined') ? cacheUserInfo.phoneNumber : ''
        let that = this
        let reqUri = app.globalData.domain + 'v4/index/latestPersonPredict';
        wx.request({
            url: reqUri,
            data: {
                user_phone: user_phone,
                question_id: that.data.currentItem.id,
                title1: that.data.title1,
                title2: that.data.title2,
                title3: that.data.title3,
                date1: that.data.date1,
                startdate: that.data.startdate,
                enddate: that.data.enddate,
                time_pay: time_pay,
            },
            success(res) {
                if (res.data.code == app.globalData.successCode) {
                    that.setMd5Today() //标记今日已咨询的问题
                    //将提问放入缓存
                    let questionArr = {
                        question_id: that.data.currentItem.id,
                        title1: that.data.title1,
                        title2: that.data.title2,
                        title3: that.data.title3,
                        date1: that.data.date1,
                        startdate: that.data.startdate,
                        enddate: that.data.enddate,
                    }
                    //将数据放入缓存
                    wx.setStorage({
                        key: 'questionInfo',
                        data: questionArr
                    })
                    //跳转loading页
                    wx.navigateTo({
                        url: '/pages/loading/loading?history_id=' + res.data.data.history_id + '&cid3=' + that.data.cid3 + '&xzdata1=' + that.data.xzdata1 + '&xztype=' + that.data.xztype + '&question_id=' + that.data.currentItem.id,
                    })
                } else {
                    Toast(res.data.msg);
                }
            }
        })
    },
    bindDataChange1(e) {
        console.log('picker发送选择改变，携带值为', e.detail.value)
        this.setData({
            xztype: e.detail.value
        })
    },
    bindDataChange: function (e) {
        // console.log(e)
        console.log('picker发送选择改变，携带值为', e.detail.value)
        var idate = e.currentTarget.dataset.idate;
        this.setData({
            [idate]: e.detail.value
        })
        //限制时间段最长30天
        if (idate == 'startdate') {
            let start = e.detail.value
            let end = start
            let newday = new Date(start).getTime() + 30 * 24 * 60 * 60 * 1000;
            newday = new Date(newday)
            end = [newday.getFullYear(), (newday.getMonth() + 1 < 10 ? '0' : '') + (newday.getMonth() + 1), (newday.getDate() < 10 ? '0' : '') + newday.getDate()].join('-')

            this.setData({
                enddateStart: start,
                enddateEnd: end,
                enddate: this.data.enddate > end ? '' : this.data.enddate,
            })
        }
        if (idate == 'enddate' && this.data.startdate == '') {
            let end = e.detail.value
            let start = end
            let newday = new Date(end).getTime() - 30 * 24 * 60 * 60 * 1000;
            newday = new Date(newday)
            start = [newday.getFullYear(), (newday.getMonth() + 1 < 10 ? '0' : '') + (newday.getMonth() + 1), (newday.getDate() < 10 ? '0' : '') + newday.getDate()].join('-')

            this.setData({
                startdateStart: start,
                startdateEnd: end,
                startdate: '',
            })
        }
    },
    bindMultiDatePickerChange: function (e) {
        var idx = e.detail.value
        var dateStr = ''
        if (idx[0] > 0) {
            dateStr = this.data.multiDateArray[0][idx[0]]
        }
        if (idx[1] > 0) {
            dateStr = dateStr + '-' + this.data.multiDateArray[1][idx[1]]
        }
        if (idx[2] > 0) {
            dateStr = dateStr + '-' + this.data.multiDateArray[2][idx[2]]
        }
        let idate = e.currentTarget.dataset.idate;
        this.setData({
            multiDateIndex: e.detail.value,
            [idate]: dateStr
        })
    },
    bindMultiDatePickerColumnChange: function (e) {
        console.log('修改的列为', e.detail.column, '，值为', e.detail.value);
        wx.setStorageSync('adeNum', 0);
        var data = {
            multiDateArray: this.data.multiDateArray,
            multiDateIndex: this.data.multiDateIndex
        };
        data.multiDateIndex[e.detail.column] = e.detail.value;
        if (e.detail.column == 0) {
            if (data.multiDateIndex[0] == 0) {
                data.multiDateArray[1] = ['选择'];
                data.multiDateArray[2] = ['选择'];
            } else {
                data.multiDateArray[1] = ['选择', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
                if (data.multiDateIndex[1] == 0) {
                    data.multiDateArray[2] = ['选择'];
                } else {
                    var year = data.multiDateArray[0][data.multiDateIndex[0]]
                    var month = data.multiDateArray[1][data.multiDateIndex[1]]
                    var days = (new Date(year, month, 0)).getDate()
                    var d = ['选择'];
                    for (let i = 0; i < days; i++) {
                        let dayNum = i + 1
                        d.push(dayNum < 10 ? '0' + dayNum : '' + dayNum)
                    }
                    console.log(d)
                    data.multiDateArray[2] = d;
                }
            }
        }
        if (e.detail.column == 1) {
            if (data.multiDateIndex[1] == 0) {
                data.multiDateArray[2] = ['选择'];
            } else {
                var year = data.multiDateArray[0][data.multiDateIndex[0]]
                var month = data.multiDateArray[1][data.multiDateIndex[1]]
                var days = (new Date(year, month, 0)).getDate()
                var d = ['选择'];
                for (let i = 0; i < days; i++) {
                    let dayNum = i + 1
                    d.push(dayNum < 10 ? '0' + dayNum : '' + dayNum)
                }
                data.multiDateArray[2] = d;
            }
        }
        data.multiDateIndex[0] = data.multiDateIndex[0] < data.multiDateArray[0].length ? data.multiDateIndex[0] : 0;
        data.multiDateIndex[1] = data.multiDateIndex[1] < data.multiDateArray[1].length ? data.multiDateIndex[1] : 0;
        data.multiDateIndex[2] = data.multiDateIndex[2] < data.multiDateArray[2].length ? data.multiDateIndex[2] : 0;
        this.setData(data);
    },
    bindMultiDatePickerChang1: function (e) {
        var idx = e.detail.value
        var dateStr = ''
        if (idx[0] > 0) {
            dateStr = this.data.multiDateArray[0][idx[0]]
        }
        if (idx[1] > 0) {
            dateStr = dateStr + '-' + this.data.multiDateArray[1][idx[1]]
        }
        if (idx[2] > 0) {
            dateStr = dateStr + '-' + this.data.multiDateArray[2][idx[2]]
        }
        let idate = e.currentTarget.dataset.idate;
        this.setData({
            multiDateInde1: e.detail.value,
            [idate]: dateStr
        })
    },
    bindMultiDatePickerColumnChang1: function (e) {
        console.log('修改的列为', e.detail.column, '，值为', e.detail.value);
        wx.setStorageSync('adeNum', 0);
        var data = {
            multiDateArray: this.data.multiDateArray,
            multiDateInde1: this.data.multiDateInde1
        };
        data.multiDateInde1[e.detail.column] = e.detail.value;
        if (e.detail.column == 0) {
            if (data.multiDateInde1[0] == 0) {
                data.multiDateArray[1] = ['选择'];
                data.multiDateArray[2] = ['选择'];
            } else {
                data.multiDateArray[1] = ['选择', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
                if (data.multiDateInde1[1] == 0) {
                    data.multiDateArray[2] = ['选择'];
                } else {
                    var year = data.multiDateArray[0][data.multiDateInde1[0]]
                    var month = data.multiDateArray[1][data.multiDateInde1[1]]
                    var days = (new Date(year, month, 0)).getDate()
                    var d = ['选择'];
                    for (let i = 0; i < days; i++) {
                        let dayNum = i + 1
                        d.push(dayNum < 10 ? '0' + dayNum : '' + dayNum)
                    }
                    console.log(d)
                    data.multiDateArray[2] = d;
                }
            }
        }
        if (e.detail.column == 1) {
            if (data.multiDateInde1[1] == 0) {
                data.multiDateArray[2] = ['选择'];
            } else {
                var year = data.multiDateArray[0][data.multiDateInde1[0]]
                var month = data.multiDateArray[1][data.multiDateInde1[1]]
                var days = (new Date(year, month, 0)).getDate()
                var d = ['选择'];
                for (let i = 0; i < days; i++) {
                    let dayNum = i + 1
                    d.push(dayNum < 10 ? '0' + dayNum : '' + dayNum)
                }
                data.multiDateArray[2] = d;
            }
        }
        data.multiDateInde1[0] = data.multiDateInde1[0] < data.multiDateArray[0].length ? data.multiDateInde1[0] : 0;
        data.multiDateInde1[1] = data.multiDateInde1[1] < data.multiDateArray[1].length ? data.multiDateInde1[1] : 0;
        data.multiDateInde1[2] = data.multiDateInde1[2] < data.multiDateArray[2].length ? data.multiDateInde1[2] : 0;
        this.setData(data);
    },
    bindMultiDatePickerChang2: function (e) {
        var idx = e.detail.value
        var dateStr = ''
        if (idx[0] > 0) {
            dateStr = this.data.multiDateArray[0][idx[0]]
        }
        if (idx[1] > 0) {
            dateStr = dateStr + '-' + this.data.multiDateArray[1][idx[1]]
        }
        if (idx[2] > 0) {
            dateStr = dateStr + '-' + this.data.multiDateArray[2][idx[2]]
        }
        let idate = e.currentTarget.dataset.idate;
        this.setData({
            multiDateInde2: e.detail.value,
            [idate]: dateStr
        })
    },
    bindMultiDatePickerColumnChang2: function (e) {
        console.log('修改的列为', e.detail.column, '，值为', e.detail.value);
        wx.setStorageSync('adeNum', 0);
        var data = {
            multiDateArray: this.data.multiDateArray,
            multiDateInde2: this.data.multiDateInde2
        };
        data.multiDateInde2[e.detail.column] = e.detail.value;
        if (e.detail.column == 0) {
            if (data.multiDateInde2[0] == 0) {
                data.multiDateArray[1] = ['选择'];
                data.multiDateArray[2] = ['选择'];
            } else {
                data.multiDateArray[1] = ['选择', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
                if (data.multiDateInde2[1] == 0) {
                    data.multiDateArray[2] = ['选择'];
                } else {
                    var year = data.multiDateArray[0][data.multiDateInde2[0]]
                    var month = data.multiDateArray[1][data.multiDateInde2[1]]
                    var days = (new Date(year, month, 0)).getDate()
                    var d = ['选择'];
                    for (let i = 0; i < days; i++) {
                        let dayNum = i + 1
                        d.push(dayNum < 10 ? '0' + dayNum : '' + dayNum)
                    }
                    console.log(d)
                    data.multiDateArray[2] = d;
                }
            }
        }
        if (e.detail.column == 1) {
            if (data.multiDateInde2[1] == 0) {
                data.multiDateArray[2] = ['选择'];
            } else {
                var year = data.multiDateArray[0][data.multiDateInde2[0]]
                var month = data.multiDateArray[1][data.multiDateInde2[1]]
                var days = (new Date(year, month, 0)).getDate()
                var d = ['选择'];
                for (let i = 0; i < days; i++) {
                    let dayNum = i + 1
                    d.push(dayNum < 10 ? '0' + dayNum : '' + dayNum)
                }
                data.multiDateArray[2] = d;
            }
        }
        data.multiDateInde2[0] = data.multiDateInde2[0] < data.multiDateArray[0].length ? data.multiDateInde2[0] : 0;
        data.multiDateInde2[1] = data.multiDateInde2[1] < data.multiDateArray[1].length ? data.multiDateInde2[1] : 0;
        data.multiDateInde2[2] = data.multiDateInde2[2] < data.multiDateArray[2].length ? data.multiDateInde2[2] : 0;
        this.setData(data);
    },
})